<div class="main-content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <form class="card-header border-bottom row form-inline" action="/<?php echo site_url("pages") ?>" method="get">
                        <h4 class="card-title col-lg-2 col-md-6 col-xs-12">文章列表</h4>
                        <div class="col-lg-10 col-md-6 col-xs-12">
                            <label class="sr-only" for="sub_id">公众号id</label>
                            <input type="text" class="form-control mb-2 mr-sm-2" id="sub_id" name="sub_id" placeholder="公众号id">
                            <label class="sr-only" for="sub_name">公众号名称</label>
                            <input type="text" class="form-control mb-2 mr-sm-2" id="sub_name" name="sub_name" placeholder="公众号名称">
                            <label class="sr-only" for="p_title">文章标题</label>
                            <input type="text" class="form-control mb-2 mr-sm-2" id="p_title" name="p_title" placeholder="文章标题">
                            <button type="submit" class="btn btn-primary mb-2">查询</button>
                        </div>
                    </form>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-bordered mb-0">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>文章标题</th>
                                    <th>公众号名称</th>
                                    <td>文章发布时间</td>
                                    <th>采集时间</th>
                                    <th>状态</th>
                                    <td>查看</td>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                $num = count($pages);
                                for ($l=0; $l<$num; $l++) {?>
                                    <tr>
                                        <th scope="row"><?php echo $l+1; ?></th>
                                        <td><?php echo $pages[$l]["p_title"]; ?></td>
                                        <td><?php echo $pages[$l]["sub_name"]; ?></td>
                                        <td><?php echo $pages[$l]["p_public_time"]; ?></td>
                                        <td><?php echo $pages[$l]["p_collect_time"]; ?></td>
                                        <td>
                                            <?php
                                            switch ($pages[$l]["p_status"]){
                                                case 0:
                                                    ?>
                                                    <span class="badge badge-success">完成</span>
                                                    <?php
                                                    break;
                                                case 1:
                                                    ?>
                                                    <span class="badge badge-warning">进行中</span>
                                                    <?php
                                                    break;
                                                case 2:
                                                    ?>
                                                    <span class="badge badge-info">等待</span>
                                                    <?php
                                                    break;
                                                default:
                                                    ?>
                                                    <span class="badge badge-danger">异常</span>
                                                <?php
                                            }
                                            ?>
                                        </td>
                                        <td>
                                            <a class="badge badge-info" href="<?php echo $pages[$l]["p_link"]; ?>">查看原页面</a>
                                            <a class="badge badge-warning" href="/cache/<?php echo $pages[$l]["sub_id"]."/".$pages[$l]["p_file"]; ?>" >查看缓存页面</a>
                                        </td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>